﻿namespace TextFiles
{
    using System;
    using System.IO;

    class CompareLinesOfTwoFiles
    {
        // 1.2.12.04. Write a program that compares two text files line by line and prints the number of lines that are
        // the same and the number of lines that are different. Assume the files have equal number of lines.

        static void Main()
        {
            StreamReader sr1 = new StreamReader(@"../../asdf.txt");
            StreamReader sr2 = new StreamReader(@"../../fdsa.txt");

            string firstFileLine = sr1.ReadLine();
            string secondFileLine = sr2.ReadLine();
            int equalLines = 0;
            int nonEqualLines = 0;

            while (firstFileLine != null)
            {
                if (firstFileLine == secondFileLine)
                {
                    equalLines++;
                }
                else
                {
                    nonEqualLines++;
                }

                firstFileLine = sr1.ReadLine();
                secondFileLine = sr2.ReadLine();
            }
            sr1.Close();
            sr2.Close();

            Console.WriteLine("Equal lines: " + equalLines);
            Console.WriteLine("Non-equal lines: " + nonEqualLines);
        }
    }
}